<?php
// +----------------------------------------------------------------------
// | KITEGO-Admin「开箱即用」「人人全栈」
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2024 https://www.kitego.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed KITEGO并不是自由软件，未经许可不能去掉KITEGO相关版权
// +----------------------------------------------------------------------
// | Author: KITEGO Team <bd@kitego.cn>
// +----------------------------------------------------------------------

namespace kitego\extend\login\admin;

use kitego\extend\login\admin\enum\AdminLoginEnum;
use kitego\extend\login\admin\impl\AdminGiteeLoginImpl;
use kitego\extend\login\admin\impl\AdminPasswordLoginImpl;

class AdminLoginProvider
{
    protected $strategy;

    public function __construct($type)
    {
        switch ($type) {
            case AdminLoginEnum::PASSWORD:
                $this->strategy = new AdminPasswordLoginImpl();
                break;
            case AdminLoginEnum::GITEE:
                $this->strategy = new AdminGiteeLoginImpl();
                break;
            default:
                exception('不支持的登录方式');
        }
    }

    public function getStrategy()
    {
        return $this->strategy;
    }
}